<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <meta charset="UTF-8">
    <style>
        body{
            background-color: #cde0e5;
            text-align:center;
        }
        a{
            text-decoration:none;
            color: black;
        }
        #Questionnaires_box{

            text-align:center;
            margin: 0 auto;
            width : 75%;
            background-color: white;
            opacity: 0.8;
            border-radius:10px;
            box-shadow: 5px 5px 5px 5px #969899;
        }
        #content{
            margin: 0 auto;
        }
    </style>
    <title>后台管理</title>
</head>
<body>
    <nav class="navbar navbar-default navbar-inverse navbar-fixed-top"
         role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" >LOGO</a>
            </div>
            <ul class="nav navbar-nav">

                <th:block th:if="(${username}) == 'root' ">
                    <li><a target="_blank" href="../logout" th:target="_self">退出登陆
                    </a></li>
                </th:block>
                <th:block th:unless="(${username}) == 'root' ">
                    <li><a target="_blank" href="../login"
                           th:target="_self">管理员登陆
                    </a></li>
                </th:block>
            </ul>
        </div>
    </nav>

    <th:block th:unless="(${username}) == 'root'">
        <div style="height:120px;"></div>
    </th:block>
    <th:block th:if="(${username}) == 'root' ">
        <div style="height:60px;"></div>
        <h1 class="text-center">后台管理系统</h1>
    </th:block>

    <div class="container-fluid">
        <div class="row">
            <div class="col">
                <div id="Questionnaires_box">
                    <div style="height: 14px;"></div>

                    <th:block th:if="(${username}) == 'root' ">
                        <div style="height:45px;">
                            <a th:href="@{'/admin/add'}">
                                <input id="add_button" type="button" value="添加问卷" class="btn btn-default">
                            </a>
                        </div>
                    </th:block>
                    <div id="content">
                        <table id="questionnaires_table" class="table table-striped">
                            <tr th:id="questionnaire + (${ques.id})" th:each="ques : ${allquestionnaire}">
                                <td style="display: flex;justify-content: space-around; align-content: baseline">
                                    <div class="col-sm-6">
                                        <a th:href="@{'/questionnaire/' + ${ques.getId()} + '/view'}"><h4 th:text="${ques.getName()}"></h4></a>
                                    </div>
                                    <th:block th:if="(${username}) == 'root' ">
                                        <a th:href="@{'/questionnaire/' + ${ques.getId()} + '/delete'}"><h4 th:text="删除"></h4></a>
                                        <a th:href="@{'/questionnaire/' + ${ques.getId()} + '/gettxt'}"><h4 th:text="导出主观题"></h4></a>
                                        <a th:href="@{'/questionnaire/' + ${ques.getId()} + '/exportExcel'}"><h4 th:text="导出客观题"></h4></a>

                                    </th:block>
                                </td>
                            </tr>

                        </table>
                        <div style="height: 14px;"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>